home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / f2c / may_5_92.lha / f2c.VMay_5_1992 / libF77 / pow_hh.c < prev    next >
C/C++ Source or Header  |  1992-05-07  |  245b  |  26 lines

  1. #include "f2c.h"
  2.  
  3. shortint pow_hh(ap, bp)
  4. shortint *ap, *bp;
  5. {
  6. shortint pow, x, n;
  7.  
  8. pow = 1;
  9. x = *ap;
  10. n = *bp;
  11.  
  12. if(n < 0)
  13.     { }
  14. else if(n > 0)
  15.     for( ; ; )
  16.         {
  17.         if(n & 01)
  18.             pow *= x;
  19.         if(n >>= 1)
  20.             x *= x;
  21.         else
  22.             break;
  23.         }
  24. return(pow);
  25. }
  26.